from django.contrib import admin
from apps.admins.models import StaffInfoModel, PostInfoModel


# Register your models here.


class StaffInfoAdmin(admin.ModelAdmin):
    """
    员工信息管理类
    """
    list_display = ['id', 'name', 'nickname', 'phone', 'password', 'birthday',
                    'gender', 'post', 'join_date', 'is_active', 'expand_json', 'created_time']
    ordering = ('id',)
    fields = ['id', 'name', 'nickname', 'phone', 'password', 'birthday',
              'gender', 'post', 'join_date', 'is_active', 'expand_json', 'created_time']
    list_filter = ['id', 'name', 'nickname', 'phone', 'password', 'birthday',
                   'gender', 'post', 'join_date', 'is_active', 'expand_json', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name', 'nickname', 'phone', 'password', 'birthday',
                     'gender', 'post', 'join_date', 'is_active', 'expand_json', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class PostInfoAdmin(admin.ModelAdmin):
    """
    职位信息管理类
    """
    list_display = ['id', 'name', 'desc', 'expand_json', 'created_time']
    ordering = ('id',)
    fields = ['id', 'name', 'desc', 'expand_json', 'created_time']
    list_filter = ['id', 'name', 'desc', 'expand_json', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name', 'desc', 'expand_json', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


admin.site.register(StaffInfoModel, StaffInfoAdmin)
admin.site.register(PostInfoModel, PostInfoAdmin)
